import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * @author gao
 * @date 2025/11/4 9:19
 */

public class Solution {

    StringBuffer letter;
    List<String> ret;

    public List<String> letterCasePermutation(String s) {
        letter = new StringBuffer();
        ret = new ArrayList<>();

        dfs(s, 0);
        return ret;
    }

    private void dfs(String s, int pos) {
        // 到达字符串末尾，将当前组合添加到结果列表中
        if (pos == s.length()) {
            ret.add(letter.toString());
            return;
        }

        char ch = s.charAt(pos);
        letter.append(ch);
        // 递归处理下一个位置
        dfs(s, pos + 1);
        // 回溯，删除最后一个字符
        letter.deleteCharAt(letter.length() - 1);

        // 如果当前字符是字母，则尝试转换大小写
        if (Character.isLetter(ch)) {
            char tmp = change(ch);
            letter.append(tmp);
            dfs(s, pos + 1);
            // 回溯，删除最后一个字符
            letter.deleteCharAt(letter.length() - 1);
        }
    }

    private char change(char ch) {
        if (Character.isUpperCase(ch)) {
            // 大写转小写
            ch = Character.toLowerCase(ch);
        } else {
            // 小写转大写
            ch = Character.toUpperCase(ch);
        }
        return ch;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            String s = in.nextLine();
            Solution solution = new Solution();
            System.out.println(solution.letterCasePermutation(s));
        }
    }
}